package com.anzia.streamreader;

import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

/**
 *@ClassName OutputStreamReader_Demo
 *@Description
 *@Author Anzia.
 *@Date 2021/4/9 17:51
 *@Version 1.0
 **/
public class OutputStreamReader_Demo {
    public static void main(String[] args) throws Exception {
        //创建对象
        FileOutputStream fos = new FileOutputStream("static\\info.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos,"gbk");

        //写入
        for (int i = 0; i < 10; i++) {
            osw.write("好想工作赚钱谈恋爱hhh\r\n");
            osw.flush();
        }

        //关闭
        osw.close();
        System.out.println("执行完毕！");
    }
}
